#ifndef __JSONPATHSQUAREBRACKET_H__
#define __JSONPATHSQUAREBRACKET_H__

#include <string>

#include "JsonPathFilterExpr.h"
#include "JsonPathIndex.h"

class JsonPathSquareBracket
{
public:
    JsonPathSquareBracket(std::string str);
    bool IsValid();

private:
    bool Tokenization(std::string str);
    bool TokenizationFilterExpr(std::string strExpr);
    bool TokenizationIndex(std::string strIndex);

private:
    JsonPathFilterExpr GetAndDeleteJPFE(std::string strUUID);

public:
    enum JsonPathSquareBracketType
    {
        JsonPathSquareBracketType_FilterExpr, // [?()]
        JsonPathSquareBracketType_Index,     // [0] [0:2] [0:10:2] [0,3]
        JsonPathSquareBracketType_Wildcard,  // [*]
        JsonPathSquareBracketType_Max
    };
    JsonPathSquareBracketType m_eType;

    bool m_bValid;
    std::vector<JsonPathFilterExpr> m_vecFilterExpr;
    JsonPathIndex m_jpiIndex;
};

#endif //__JSONPATHSQUAREBRACKET_H__
